package com.example.easyscript.common.minio.bo;



import com.example.easyscript.common.minio.MinioTemplate;
import lombok.Data;
import lombok.ToString;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * minio自动配置类
 */
@Component
@ConfigurationProperties(prefix = "minio")
@Data
@ToString
public class MinioBo {
    //服务地址 http://ip:port
    private String url;
    //用户名
    private String accessKey;
    // 密码
    private String secretKey;
    // excel
    private String excelPath;

    //BUCKET
    private String bucket;

    @Bean
    @ConditionalOnMissingBean(MinioTemplate.class)
    public MinioTemplate template() {
        return new MinioTemplate(
                this.url,
                this.accessKey,
                this.secretKey
        );
    }
}
